package four;

public class SunRise {
    public static void answer(String[] roots) {
        if(roots != null) {
            if(roots.length == 2) {
                System.out.println("方程的根:" + roots[0] + "," + roots[1]);
            } else {
                System.out.println("方程的根:" + roots[0]);
            }
        } else {
            System.out.println("方程无实根");
        }
    }
    public static void main(String[] args) {
        SquareEquation se = new SquareEquation(1, -1.25, 0.25);
        String[] roots = se.calculateRoots();
        answer(roots);
        se.setA(3);
        se.setB(-4);
        se.setC(-5);
        roots = se.calculateRoots();
        answer(roots);
    }
}
